﻿using System.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace MoneyWentWhere.DataModel
{
    public class CurrencyTypeConverter : StringTypeConverter<Currency>
    {
        protected override string ToString(Currency value)
        {
            if (value == null) { return null; }
            Currency cur = (Currency)value;
            return cur.Id;
        }

        protected override Currency FromString(string rep)
        {
            if (String.IsNullOrEmpty(rep)) { throw new ArgumentNullException("value"); }
            return new Currency(rep);
        }
    }
}
